<template>
    <div
    v-show="visible"
    :class="['loading-mask', customClass, { 'is-fullscreen': fullscreen }]"
    :style="{ backgroundColor: background || '' }">
      <div class="loading-content">
          <div class="loading-animate"></div>
          <div class="loading-text">{{ text }}</div>
      </div>
    </div>

</template>

<script>
export default {
    data() {
        return {
            text: '正在加载...',
            background: null,
            visible: false,
            fullscreen: false,
            customClass: '',
        }
    },
    methods: {
        setText(text) {
            this.text = text;
        }
    }
}
</script>

<style lang="scss" scoped>
  .loading-mask{
    position: absolute;
    top:0;
    bottom:0;
    left:0;
    right:0;
    // background-color:rgba(0,0,0,.6);
    background-color:rgba(255,255,255,.9);
    z-index:2000;
  }
  .is-fullscreen{
    position: fixed;
  }
.loading-content{
    position: absolute;
    left: 50%;
    top: 45%;
    z-index: 300;
    transform: translate(-50%,-45%);
    text-align: center;
    color:#fff;
    z-index:2001;
    .loading-animate{
      display: inline-block;
      width:35px;
      height:35px;
      margin: 25px 0 10px;
      vertical-align: middle;
      animation: cricleLoading 1s steps(12, end) infinite;
      background: transparent url("") no-repeat;
      background-size:100%;
    }
   .loading-text{
      color:#409EFF;
      margin:3px 0;
      font-size:14px;
    }
  }
@-webkit-keyframes cricleLoading {
  0% {
    transform: rotate3d(0,0,1,0deg);
  }
  100% {
    transform: rotate3d(0,0,1,360deg);
  }
}
@keyframes cricleLoading {
  0% {
    transform: rotate3d(0,0,1,0deg);
  }
  100% {
    transform: rotate3d(0,0,1,360deg);
  }
}


</style>
